package com.everflourish.yeah100.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.everflourish.yeah100.R;
import com.everflourish.yeah100.entity.statistics.GradeRanksModel;

import java.util.List;

/**
 * 作者：Created by liqisi on 2016/8/5.
 * 时间：2016/8/5
 */
public class GradeRanksAdapter extends BaseAdapter {
    private LayoutInflater mInflater;
    private Context mContext;
    private List<GradeRanksModel> mList;

    public GradeRanksAdapter(Context mContext, List<GradeRanksModel> mList) {
        this.mContext = mContext;
        this.mList = mList;
        mInflater = LayoutInflater.from(mContext);
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.item_statistics_filter_selected,
                    parent, false);
            viewHolder.mItemLl = (LinearLayout) convertView.findViewById(R.id.statistics_drawer_item_ll);
            viewHolder.mItemTv = (TextView) convertView.findViewById(R.id.statistics_drawer_list_tv);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        return convertView;
    }

    public class ViewHolder {
        private LinearLayout mItemLl;
        private TextView mItemTv;
    }
}
